#include <standard/notification.h>
#include "operator/terrainnull0operator.h"
#include "terrain/terrainblock.h"
#include "editorscenemgr.h"
#include "global.h"

CTerrainNull0Operator::CTerrainNull0Operator(CEditorSceneMgr *pSceneMgr):
COperator( pSceneMgr ){
    m_eOperatorType = EOT_NULL;
}
CTerrainNull0Operator::~CTerrainNull0Operator(){

}
bool32 CTerrainNull0Operator::Init(){
    m_pSceneMgr->SetSceneVisibleMode( 0 );
    return True;
}
bool32 CTerrainNull0Operator::Final() {
    return True;
}
bool32 CTerrainNull0Operator::OnLMouseDown( int32 x, int32 y ){
    //float _vSceneCoords[ 3 ];
    STerrainSelectedPosInfo _sTerrainSelectedPosInfo;
    CTerrainBlock* _pTerrainBlock = m_pSceneMgr->GetSelectBlock( x, y, &_sTerrainSelectedPosInfo );
    if( _pTerrainBlock ){
        SSETSTATUSCOORDTEXT _sSETSTATUSCOORDTEXT;
        _sSETSTATUSCOORDTEXT.m_fPosX = _sTerrainSelectedPosInfo.m_vPos[0];
        _sSETSTATUSCOORDTEXT.m_fPosY = _sTerrainSelectedPosInfo.m_vPos[1];
        _sSETSTATUSCOORDTEXT.m_fPosZ = _sTerrainSelectedPosInfo.m_vPos[2];
        _sSETSTATUSCOORDTEXT.m_nCellX = _sTerrainSelectedPosInfo.m_nCellX;
        _sSETSTATUSCOORDTEXT.m_nCellY = _sTerrainSelectedPosInfo.m_nCellY;
        NOTIFICATION_SEND( SETSTATUSCOORDTEXT, 0, 0, &_sSETSTATUSCOORDTEXT );
    }
    return False;
}
bool32 CTerrainNull0Operator::OnMouseMove( int32 x, int32 y ){
    STerrainSelectedPosInfo _sTerrainSelectedPosInfo;
    CTerrainBlock* _pTerrainBlock = m_pSceneMgr->GetSelectBlock( x, y, &_sTerrainSelectedPosInfo );
    if( _pTerrainBlock ){
        SSETSTATUSCOORDTEXT _sSETSTATUSCOORDTEXT;
        _sSETSTATUSCOORDTEXT.m_fPosX = _sTerrainSelectedPosInfo.m_vPos[0];
        _sSETSTATUSCOORDTEXT.m_fPosY = _sTerrainSelectedPosInfo.m_vPos[1];
        _sSETSTATUSCOORDTEXT.m_fPosZ = _sTerrainSelectedPosInfo.m_vPos[2];
        _sSETSTATUSCOORDTEXT.m_nCellX = _sTerrainSelectedPosInfo.m_nCellX;
        _sSETSTATUSCOORDTEXT.m_nCellY = _sTerrainSelectedPosInfo.m_nCellY;
        NOTIFICATION_SEND( SETSTATUSCOORDTEXT, 0, 0, &_sSETSTATUSCOORDTEXT );
    }
    return False;
}
bool32 CTerrainNull0Operator::OnLMouseUp( int32 x, int32 y ){
    return False;
}